/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-03-07
 * Time: 19:51
 */
public class Test {

    public static int sum(int n){
        if(n<10){
            return n;
        }
        int sum = n % 10+sum( n / 10);
        return sum;
    }
    public static void main(String[] args) {
        int n = 1977;
        int ret = sum(n);
        System.out.println(ret);
    }
}
